﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using IHISCETeim.BLL;
using IHISCETeim.Library;
using IHISCETeim.Model;
using System.Data;
using System.Text;

namespace IHISCETeim.Web.MachineSys.FTradeModel
{
    public partial class GetPageFTradeSaleTypeConfig : PageBase
    {

        protected override string DWZRef
        {
            get
            {
                return "FTradeReceivablesAdd";
            }
        }
        /// <summary>
        /// 不用权限
        /// </summary>
        protected override Permission[] PowerKey
        {
            get
            {
                return new Permission[] { Permission.none };
            }
        }

        private string _globalTag = "";
        /// <summary>
        /// 来源标记，用于ID，防止打开两个页面有相同的ID标记
        /// </summary>
        protected string globalTag {
            get
            {
                if (_globalTag == "")
                    _globalTag = GetRequestValue<string>("tag", "add");
                return _globalTag;
            }
        }
        //传入回款条款类型
        protected string key
        {
            get {
                return GetRequestValue<string>("key", "");
            }
        }

        /// <summary>
        /// 根据传入的Key处理选中项
        /// </summary>
        /// <returns></returns>
        protected string GetCheckSaleTypeConfigIds()
        {
            string checkKey = key;
            string checkIds="";
            Dictionary<string,string> sysKeyList=new Dictionary<string,string>();
            sysKeyList.Add("置换","3");
            sysKeyList.Add("代垫","4");
            sysKeyList.Add("分期","2");

            foreach(var tempItem in sysKeyList)
            {
                if (key.IndexOf(tempItem.Key) >= 0)
                {
                    checkIds = checkIds + tempItem.Value + ",";
                } 
            }

            if (checkIds == "")
                checkIds = "1,";

            return checkIds.Substring(0, checkIds.Length - 1);
            
            
        }
        protected string Summary
        {
            get
            {
                FTradeSaleTypeConfigInfo obj = FTradeSaleTypeConfigController.GetByName(key);
                return obj.Summary;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (GetRequestValue<string>("ajaxmethod", "") == "getconfigsummary")
            {
                Response.Write(Summary);
                Response.End();
            }
        }
    }
}